from socket import *


def http(conn):
    with open("new.jpg", "rb") as fr:
        data = fr.read()
    response = b"HTTP/1.1 200 OK \r\n"
    response += b"Content-Type: image/jpeg\r\n"
    response += b"\r\n"
    response += data
    conn.send(response)
    conn.close()


def main():
    sock = socket()
    sock.bind(("0.0.0.0", 8005))
    sock.listen()
    while True:
        conn, addr = sock.accept()
        print("Connect from :", addr)
        http(conn)


if __name__ == '__main__':
    main()
